﻿using System;
using System.Collections.Generic;
using System.Data.OleDb;
using System.Linq;
using System.Web;
using System.Web.Configuration;
using Common.Data;

namespace XMLSQL.Common.Data
{
    /// <summary>
    /// Author: Mike Barksdale
    /// Generic interface for user information.
    /// </summary>
    public interface IUserDataProvider
    {
        //resets a password for a user name
        void ResetPassword(string userName, string password);
    }

    /// <summary>
    /// Author: Mike Barksdale
    /// Concrete implementation of the IUserDataProvider.
    /// </summary>
    public class UserDataProvider : IUserDataProvider
    {
        //connection string to the admin database
        private readonly string _userConnectionString;

        //constructor
        public UserDataProvider()
        {
            this._userConnectionString = WebConfigurationManager.ConnectionStrings["AdminDb"].ConnectionString + "Provider=SQLOLEDB;";
        }

        //resets the user's password and returns it to the caller
        public void ResetPassword(string userName, string password)
        {
            string userId = new AdminDataProvider().GetUserIdFromUserName(userName);
        }
    }
}